<?php

/*
 * @copyright :     Ienter asia Technologies
 * @author :        Quyet
 * @version         v.1.0
 * @created         11/6/2014
 * @Description :   Class controller List Time Card
 */
if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Mod_listtimecard extends MYAD_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('mmod_listtimecard', 'ltc');
    }

    /*
     * @author :        Quyet
     * @created:        11/6/2014
     * @Input :         (Interger) $page
     * @Description:    Load List Time Card screen
     */

    public function index($page = 0) {
        /* set month, year for calculation */
        if (isset($_POST['btnSearch'])) {
            $this->ltc->setMonthYearForCalculation();
            redirect('listtimecard');
        }
        $temp = array();
        if (isset($_POST['btnsalaryCalculation'])) {
            /* Salary calculation */
            $salaryCalculation = $this->ltc->salaryCaculations();
            if ($salaryCalculation['flag']) {
                redirect('/employeesalary');
            }
            $temp['messageCalculation'] = $salaryCalculation['message'];
        }
        /* display data of last month if list time card */
        $data = $this->ltc->getAllData($page);
        $this->load->view('layout', array_merge($data, $temp));
    }

}

?>